package com.lzy.api.controller.files;

import com.lzy.grace.result.GraceJSONResult;
import com.lzy.pojo.bo.NewAdminBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "文件上传的controller的标题",tags = {"文件上传的controller的标题"})
@RequestMapping("fs")
public interface FileUploaderControllerApi {

    /**
     * @Author lzy
     * @Description 上传单文件
     */
    
    @ApiOperation(value = "上传用户头像",notes = "上传用户头像",httpMethod = "POST")
    @PostMapping("/uploadFace")
    public GraceJSONResult uploadFace(@RequestParam String userId,
                                      MultipartFile file) throws Exception;

    /**
     * @Author lzy
     * @Description 上传多文件
     */

    @ApiOperation(value = "上传多文件",notes = "上传多文件",httpMethod = "POST")
    @PostMapping("/uploadSomeFiles")
    public GraceJSONResult uploadSomeFiles(
            String userId,
            MultipartFile[] files,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception;


    /**
     * @Author lzy
     * @Description 文件上传到MongoDB的gridfs中
     */
    @PostMapping("/uploadToGridFS")
    public GraceJSONResult uploadToGridFS(@RequestBody NewAdminBO newAdminBO) throws Exception;


    /**
     * @Author lzy
     * @Description 从gridfs中读取照片内容
     */
    @GetMapping("/readInGridFS")
    public void readInGridFS(String faceId,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws Exception;

    /**
     * @Author lzy
     * @Description 从gridfs中读取图片信息，并返回base64数据
     */

    @GetMapping("/readFace64InGridFs")
    public GraceJSONResult readFace64InGridFs(String faceId,
                             HttpServletRequest request,
                             HttpServletResponse response) throws Exception;
}
